﻿#include "OpenGLRenderBuffer.h"

using namespace Kriko;

OpenGLRenderBuffer::OpenGLRenderBuffer(size_t width, size_t height)
{
    glGenRenderbuffers(1, &renderbufferID);
    glBindRenderbuffer(GL_RENDERBUFFER, renderbufferID);
    glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, width, height);
    glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, renderbufferID);
}

OpenGLRenderBuffer::~OpenGLRenderBuffer()
{
    glDeleteRenderbuffers(GL_RENDERBUFFER, &renderbufferID);
}
